#include <iostream>
#include <string>

using namespace std;

long long* powTable;

long long getHash(const string& str, size_t from, size_t to, int dif) {
    long long hash = 0;

    for (size_t i = from; i < to; ++i) {
        hash += (str[i] + 1) * powTable[dif + i - from];
    }

    return hash;
}

bool isEqual(string str1, size_t from, string str2) {
    for (size_t i = from; i < from + str2.length(); ++i) {
        if (str1[i] != str2[i - from]) return false;
    }

    return true;
}

void readString(string& str) {
     str = "";
     char c;
     
     scanf("%c",&c);
     while (c != '\n' && c != EOF) {
           str += c;
           scanf("%c",&c);
     }
}

int main(){
    string input;
    string subString;

    readString(input);
    powTable = new long long[input.length()];
    powTable[input.length() - 1] = 1;
    for (int i = input.length() - 2; i >= 0; --i) { powTable[i] = powTable[i + 1] * 33; }
    
    readString(subString);
    while (subString != "") {
    
        int dif = input.length() - subString.length();

        if (dif < 0) { cout<<"NO"<<endl; readString(subString); continue; }

        long long subHash = getHash(subString, 0, subString.length(), dif);
        long long frstHash = getHash(input, 0, subString.length(), dif);

        if (subHash == frstHash && isEqual(input, 0, subString)) { cout<<"0 - "<<subString.length()<<endl; }
        else {
            bool found = false;
            for (size_t i = 0; i < input.length() - subString.length(); ++i) {
                frstHash -= (input[i] + 1) * powTable[dif];
                frstHash += frstHash<<5;
                frstHash += input[i + subString.length()] + 1;

                if (subHash == frstHash) {
                    if (isEqual(input, i + 1, subString)) { 
                        cout<<i + 1<<" - "<<i + subString.length()<<endl; 
                        found = true;
                        break; 
                    }
                }
            }
            if (!found) cout<<"NO"<<endl;
        }
        
        readString(subString);
    }
    
    delete[] powTable;
    system("pause");
    return 0;
}
